#include <iostream>

using namespace std;

int main() {
    int n = 0;
    cin >> n;
    long long x = 0;
    cout << "1 ";
    for (int i = 2; i < n; i++) {
        int j = 10000000;
        x = i * i;
        while (j / i >= 10) {
            j /= 10;
        }
        x %= j;
        if (x == i)
            cout << i << " ";
    }
    return 0;
}
